package soft863.com.phone;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class flRd extends Reducer<Text, Flow, Text, Flow> {
    @Override
    protected void reduce(Text key, Iterable<Flow> values, Context context) throws IOException, InterruptedException {
        long sumup = 0;
        long sumdown = 0;
        long sum = 0;
        for (Flow i : values
        ) {
            sumup += i.getUpflow();
            sumdown += i.getDownflow();
            sum += i.getSumflow();
        }
        context.write(key, new Flow(sumup, sumdown, sum));


    }
}
